home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 076-100 / disk_096 / tek4695 / dospecial.c < prev    next >
C/C++ Source or Header  |  1992-05-06  |  2KB  |  84 lines

  1. /* Tektronix 4695 special printer functions */
  2.  
  3. /******* printer.device/printers/Tektronix_4695_special_functions **********
  4.  *
  5.  *    Name
  6.  *    Tektronix 4695 special functions implemented:
  7.  *
  8.  *    aRIN, aSLRM, aSFC
  9.  *************************************************************************/
  10.  
  11. #include    "exec/types.h"
  12. #include    "devices/printer.h"
  13. #include    "devices/prtbase.h"
  14.  
  15. extern struct PrinterData *PD;
  16.  
  17. long
  18. DoSpecial(command,outputBuffer,vline,currentVMI,crlfFlag,Parms)
  19. register char outputBuffer[];
  20. register UWORD *command;
  21.  
  22. register BYTE *vline;
  23. register UBYTE *currentVMI;    /* used for color on this printer */
  24. BYTE *crlfFlag;
  25. UBYTE Parms[];
  26. {
  27.     register int x = 0;
  28.     register int y = 0;
  29.     static BYTE ISOcolorTable[10] = 
  30.         {'1','3','5','4','7','2','6','0','1','1'};
  31.     static unsigned char initMarg[] = "\033H001090";
  32.  
  33.     if(*command==aRIN) {
  34.         *currentVMI = 0x70;    /* white background, black text */
  35.         outputBuffer[x++] = '\015';
  36.         outputBuffer[x++] = '\012';
  37.  
  38.         Parms[0] = (PD->pd_Preferences.PrintLeftMargin);
  39.         Parms[1] = (PD->pd_Preferences.PrintRightMargin);
  40.         *command = aSLRM;
  41.     }
  42.  
  43.     if(*command==aSLRM) {
  44.         *Parms += 4;
  45.         if (Parms[0]<5) 
  46.             Parms[0] = 5;
  47.  
  48.         Parms[1] += 5;
  49.         if (Parms[1]>90) 
  50.             Parms[1] = 90;
  51.  
  52.         initMarg[4] = (char)((Parms[0]/10)+'0');
  53.         initMarg[5] = (char)((Parms[0]-(UBYTE)(Parms[0]/10)*10)+'0');
  54.         initMarg[6] = (char)((Parms[1]/10)+'0');
  55.         initMarg[7] = (char)((Parms[1]-(UBYTE)(Parms[1]/10)*10)+'0');
  56.         while (y<10) 
  57.             outputBuffer[x++] = initMarg[y++];
  58.         return(x);
  59.     }
  60.  
  61.     if(*command==aSFC) {
  62.         if (Parms[0]==39) 
  63.             Parms[0] = 30;    /* set defaults */
  64.         if (Parms[0]==49) 
  65.             Parms[0] = 47;
  66.  
  67.         if (Parms[0]<40) 
  68.             *currentVMI = ((*currentVMI)&240)+(Parms[0]-30);
  69.         else 
  70.             *currentVMI = ((*currentVMI)&15)+((Parms[0]-40)*16);
  71.  
  72.         outputBuffer[x++] = '\033';
  73.         outputBuffer[x++] = 'C';
  74.         outputBuffer[x++] = ISOcolorTable[(*currentVMI)&15];
  75.         outputBuffer[x++] = ISOcolorTable[(((*currentVMI)&240)/16)];
  76.         return(x);
  77.     }
  78.  
  79.     if(*command==aRIS) 
  80.         PD->pd_PWaitEnabled = 253;
  81.  
  82.     return(0);
  83. }
  84.